import LogicFlow from '@logicflow/core/types/LogicFlow'
import UserTask from '../component/UserTaskNode'
import Start from '../component/StartNode'
import Polyline from '../component/PolylineNode'
import ExclusiveGateway from '../component/ExclusiveGatewayNode'
import End from '../component/EndNode'
import ParallelGateway from '../component/ParallelGatewayNode'
import InclusiveGateway from '../component/InclusiveGatewayNode'
import { NodeType } from './types'

type PatternItem = {
  type?: string;
  text?: string;
  label?: string;
  icon?: string;
  className?: string;
  properties?: object;
  callback?: () => void;
};

export const dragPanelData: PatternItem[] = [
  {
    type: NodeType.START,
    label: '开始节点',
    icon: ''
  },
  {
    type: NodeType.USER_TASK,
    label: '用户任务',
    icon: '',
    className: 'important-node'
  },
  {
    type: NodeType.EXCLUSIVE_GATEWAY,
    label: '互斥网关',
    icon: ''
  },
  {
    type: NodeType.PARALLEL_GATEWAY,
    label: '并行网关',
    icon: ''
  },
  {
    type: NodeType.INCLUSIVE_GATEWAY,
    label: '包含网关',
    icon: ''
  },
  {
    type: NodeType.END,
    label: '结束节点',
    icon: ''
  }

]

export const componentRegistry = (lf: LogicFlow) => {
  lf.register(UserTask)
  lf.register(Start)
  lf.register(Polyline)
  lf.register(ExclusiveGateway)
  lf.register(End)
  lf.register(ParallelGateway)
  lf.register(InclusiveGateway)
}
